#include "archive.hpp"
#include <iostream>
#include <fstream>
#include <ios>
using namespace fur;
void unpackfile(FileHead *filehead, std::ifstream &infile)
{
   std::ofstream outfile(filehead->get_filename(), std::ios::out|std::ios::binary);
   Unpack unpack(infile, outfile, *filehead);
   unpack.do_unpack();
}

int main(int argc, char **argv)
try
{
   std::ifstream infile(argv[1], std::ios::in | std::ios::binary);
   Archive archive(infile);
   archive.extract();
   return 0;
}
catch (std::bad_alloc)
{
   std::cerr<<"Error: Allocation failed in function "<<__func__<<std::endl;
   return static_cast<int>(ExceptionType::ALLOCATION);
}
catch (const fur::Exception &ec)
{
   ec.output();
   return static_cast<int>(ec.type());
}
